##############################################################################
# Filename: Description_Sample.R
# Purpose: Produce descriptive statistics in SI Section A1
##############################################################################

source("Setup.R")

### Table A1: Selected participant characteristics
desc_vars = c("Age","Male", 
              "Zone_Central","Zone_East","Zone_North","Zone_Northeast","Zone_South","Zone_West", 
              "Christian","Hindu","Muslim","Religion_non3",
              "Caste_Brahmin","Caste_Forward","Caste_SCST","Caste_OBC","Caste_NotApp",
              "CollegeGrad","NewsDaily","StrongInterestPolitics",
              "HindiVersion", "SawFB","SawIG","SawElsewhere","DeviceMobile")
stargazer::stargazer(data_full[desc_vars], type="text")
rm(desc_vars)

### Additional information

## Pro-BJP: first row in Table A1; also referenced in footnote 9 of main text
table(data_full$ProBJP) / nrow(data_full) 

## Time taken to complete *entire* survey: last row of Table A1
mean(data_full$DurationMinutes[data_full$CompletionStatus=="Finished"])

## Number of completions: referred to in Section A1 as well as Section 5
table(data_full$CompletionStatus)
# Completed article evaluation questions
length(which(data_full$CompletionStatus=="Finished" | 
               data_full$CompletionStatus=="PolicyopsDone" |
               data_full$CompletionStatus=="NewsConsArea"))
# Completed opinion questions
length(which(data_full$CompletionStatus=="Finished" | 
               data_full$CompletionStatus=="PolicyopsDone"))

## Income: in-text description in Section A1
Income.cleaned = as.numeric(as.character(data_full$Income))
summary(Income.cleaned)
p95_inc <- as.numeric(quantile(Income.cleaned, 0.95, na.rm=TRUE))
Income.cleaned = Income.cleaned[which(Income.cleaned < p95_inc & Income.cleaned != 0)]
summary(Income.cleaned)
rm(Income.cleaned, p95_inc)